#include <stdio.h>



int main(){
	char option, option2;
	int num1, num2, num3, num4, num5, fac, i;

	do {
		printf("Enter an option:\n");
		printf("Sumar: (s)\n");
		printf("Subtract: (r)\n");
		printf("Factorial: (f)\n");
		printf("Quit: (q)\n");
		scanf("%c", &option);
		scanf("%c", &option2);
		switch (option){
			
			case 's':
			case 'S':
				printf("Enter the first number to add:");
				scanf("%d", &num1);
				printf("Enter the second number to add:");
				scanf("%d", &num2);
				scanf("%c", &option2);
				printf("The sum of %d and %d is: %d\n\n", num1, num2, num1 + num2);
				break;
			case 'r':
			case 'R':
				printf("Enter the first number to subtract:");
				scanf("%d", &num3);
				printf("Enter the second number to subtract:");
				scanf("%d", &num4);
				scanf("%c", &option2);
				printf("The subtraction of %d and %d is: %d\n", num3, num4, num3 - num4);
				break;

			case 'f':
			case 'F':
				printf("Enter the number to it's factorial:");
				scanf("%d", &num5);
				scanf("%c", &option2);
				fac = 1;
				for (i = 1; i <= num5; i++){
					fac = fac * i;
				}
				printf("The factorial of %d is %d\n\n", num5, fac);
				break;
		}
		
	} while (option != 'q' && option != 'Q');
	return 0;
}


